import java.util.Arrays;
public class Test01{
    public static double myTest(String type,int... a){
        double r=0.0;
        double sum=0;
        double avg=0;
        for(int i=0;i<a.length;i++){
            sum+=a[i];
        }
        if(type=="sum"){
           r=sum;
        }else if(type=="avg"){
        avg=sum/a.length;
          r=avg;
        }else if(type=="max"){
          Arrays.sort(a);
          double max=a[a.length-1];
          r=max;
        }
        return r;
     }
    public static void main(String[] args){
        double s=myTest("sum",1,2,3);
        double p=myTest("avg",4,6,5);
        double m=myTest("max",7,4,9);
        System.out.println("sum="+s);
        System.out.println("avg="+p);
        System.out.println("max="+m);
    }
 }
